/**
 * Created by Tim on 2017/5/23.
 */
$(function () {
    var add_btn=$("#add_btn");
    var back_btn=$("#back_btn");
    var name=$("#name");
    var company=$("#company");
    var address=$("#address");

    var add_distributor_form=$("#add_distributor_form");


    function ParkMgr() {

    }

    ParkMgr.prototype.Constructor = ParkMgr;

    add_btn.on("click",function () {
        $(this).addClass("disabled");

        if (_isValid())
            add_distributor_form.submit();

        add_btn.removeClass("disabled");

    });

    back_btn.on("click",function () {
      window.history.go(-1);
    });


    function _isValid() {

        if (name.val()==''){
            name.focus();
            BootBox.warning("请输入商场名称！");
            return false;
        }
        if (company.val()==''){
            company.focus();
            BootBox.warning("请输入商场公司！");
            return false;
        }
        if (address.val()==''){
            address.focus();
            BootBox.warning("请输入商场地址！");
            return false;
        }
        return true;
    }

    window.ParkMgr = new ParkMgr();
});